package com.kexin.abuwx.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.kexin.common.annotation.Log;
import com.kexin.common.core.controller.BaseController;
import com.kexin.common.core.domain.AjaxResult;
import com.kexin.common.enums.BusinessType;
import com.kexin.abuwx.domain.AbucoderVideo;
import com.kexin.abuwx.service.IAbucoderVideoService;
import com.kexin.common.utils.poi.ExcelUtil;
import com.kexin.common.core.page.TableDataInfo;

/**
 * 视频管理Controller
 * 
 * @author ruoyi
 * @date 2025-04-05
 */
@RestController
@RequestMapping("/abuwx/video")
public class AbucoderVideoController extends BaseController
{
    @Autowired
    private IAbucoderVideoService abucoderVideoService;

    /**
     * 查询视频管理列表
     */
    @PreAuthorize("@ss.hasPermi('abuwx:video:list')")
    @GetMapping("/list")
    public TableDataInfo list(AbucoderVideo abucoderVideo)
    {
        startPage();
        List<AbucoderVideo> list = abucoderVideoService.selectAbucoderVideoList(abucoderVideo);
        return getDataTable(list);
    }

    /**
     * 导出视频管理列表
     */
    @PreAuthorize("@ss.hasPermi('abuwx:video:export')")
    @Log(title = "视频管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AbucoderVideo abucoderVideo)
    {
        List<AbucoderVideo> list = abucoderVideoService.selectAbucoderVideoList(abucoderVideo);
        ExcelUtil<AbucoderVideo> util = new ExcelUtil<AbucoderVideo>(AbucoderVideo.class);
        util.exportExcel(response, list, "视频管理数据");
    }

    /**
     * 获取视频管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('abuwx:video:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(abucoderVideoService.selectAbucoderVideoById(id));
    }

    /**
     * 新增视频管理
     */
    @PreAuthorize("@ss.hasPermi('abuwx:video:add')")
    @Log(title = "视频管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AbucoderVideo abucoderVideo)
    {
        return toAjax(abucoderVideoService.insertAbucoderVideo(abucoderVideo));
    }

    /**
     * 修改视频管理
     */
    @PreAuthorize("@ss.hasPermi('abuwx:video:edit')")
    @Log(title = "视频管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AbucoderVideo abucoderVideo)
    {
        return toAjax(abucoderVideoService.updateAbucoderVideo(abucoderVideo));
    }

    /**
     * 删除视频管理
     */
    @PreAuthorize("@ss.hasPermi('abuwx:video:remove')")
    @Log(title = "视频管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(abucoderVideoService.deleteAbucoderVideoByIds(ids));
    }
}
